<template>
  <div>
    <van-cell title="搜索历史">
      <!-- 控制模板显示 -->
      <van-icon
        name="delete-o"
        v-if="!isEdit"
        @click="isEdit = true"

      ></van-icon>
      <template v-else>
        <span @click="$emit('clear')">全部删除</span>&nbsp;&nbsp;&nbsp;
        <span @click="isEdit = false">完成</span>
      </template>
    </van-cell>
    <van-cell
      v-for="(item, index) in SearchHistories"
      :key="index"
      :title="item"
    >
    <!-- <van-icon name="close" @click="alert(1)"/> -->
      <van-icon name="close" @click="SearchHistories.splice(index,1)"></van-icon>
    </van-cell>
  </div>
</template>

<script>
export default {
  name: 'SearchHistory',
  props: {
    SearchHistories: {
      type: Array,
      required: true
    }
  },
  components: {

  },
  data () {
    return {
      // 控制页面状态
      isEdit: false
    }
  },
  created () {

  },
  mounted () {

  },
  methods: {

  }
}
</script>

<style>
</style>